import { createApp } from 'vue';
import './plugins/assets';
import { setupDayjs, setupIconifyOffline, setupLoading, setupNProgress } from './plugins';
import { setupStore } from './store';
import { setupRouter } from './router';
import { setupI18n } from './locales';
import { setupDirectives } from './directives';
import App from './App.vue';
// 业务组件
import SBarAddBtn from '~/src/components/custom/s-bar-add-btn.vue';
import SBarDelBtn from '~/src/components/custom/s-bar-del-btn.vue';
import SRowEditBtn from '~/src/components/custom/s-row-edit-btn.vue';
import SRowDelBtn from '~/src/components/custom/s-row-del-btn.vue';
import PopconfirmBtn from "~/src/components/custom/popconfirm-btn.vue"
import TooltipBtn from "~/src/components/custom/tooltip-btn.vue"
import SContainer from "~/src/components/custom/s-container.vue"
import TablePopconfirmBtn from "~/src/components/custom/table-popconfirm-btn.vue"
import SMoreTableBtn from "~/src/components/custom/s-more-table-btn.vue"
import SDataTable from "~/src/components/custom/s-data-table.vue"
import SDictDataTag from "~/src/components/custom/s-dict-data-tag.vue"

async function setupApp() {
  setupLoading();

  setupNProgress();

  setupIconifyOffline();

  setupDayjs();

  const app = createApp(App);

  setupStore(app);

  await setupRouter(app);

  setupI18n(app);

  setupDirectives(app);

  app.component(SBarAddBtn.name!,SBarAddBtn)
	app.component(SBarDelBtn.name!,SBarDelBtn)
	app.component(SRowEditBtn.name!,SRowEditBtn)
	app.component(SRowDelBtn.name!,SRowDelBtn)
	app.component(SContainer.name!,SContainer)
  app.component(SDataTable.name!,SDataTable)
  app.component(PopconfirmBtn.name!,PopconfirmBtn)
  app.component(TooltipBtn.name!,TooltipBtn)
  app.component(TablePopconfirmBtn.name!,TablePopconfirmBtn)
	app.component(SMoreTableBtn.name!,SMoreTableBtn)
	app.component(SDictDataTag.name!,SDictDataTag)

  app.mount('#app');
}

setupApp();
